package danny.hoi.web.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import danny.hoi.domain.export.admin.Company;
import danny.hoi.service.admin.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class CompanyController {

    @Reference(timeout = 100000)
    private CompanyService companyService;

    /**
     * 保存公司资料
     */
    @RequestMapping("/apply")
    @ResponseBody
    public String apply(Company company) {
        try {
            company.setState(0);
            companyService.save(company);
            return "1";
        } catch (Exception e) {
            e.printStackTrace();
            return "0";
        }
    }
}
